//
//  xy_checkViewController.m
//  xy_check
//
//  Created by cherry on 10-10-4.
//  Copyright __MyCompanyName__ 2010. All rights reserved.
//

#import "xy_checkViewController.h"

@implementation xy_checkViewController
@synthesize message;

/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/


// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
	UIImage *back = [UIImage imageNamed:@"p001_back.png"];
	CGRect appRect = [[UIScreen mainScreen] applicationFrame];
	UIImageView *backView = [[UIImageView alloc] initWithImage:back];
	[backView setFrame:appRect];
	[backView setAlpha:1.0f];
	[backView setUserInteractionEnabled:YES];
	self.view = backView;
	[backView release];

	CGPoint origin = CGPointMake(100.0f, 200.0f);
	CGFloat width = 68.0f;
	CGFloat height = 111.0f;
	UIImage *testImg = [UIImage imageNamed:@"p001_yumao.png"];
	
	CGRect testFrame = CGRectMake(origin.x, origin.y, width, height);
	DragView *testView = [[DragView alloc] initWithFrame:testFrame];
	[testView setUserInteractionEnabled:YES];
	[testView setImage:testImg];
	[testView setParent:self];
	[self.view addSubview:testView];
	[testView release];
	//[backView bringSubviewToFront:testView];
	
	message = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 600, 50)];
	[message setNumberOfLines:0];
	message.text = message.text = [NSString stringWithFormat:@"(%0.0f,%0.0f) --> (%0.0f,%0.0f)",testFrame.origin.x,testFrame.origin.y,testFrame.origin.x+testFrame.size.width,testFrame.origin.y+testFrame.size.height];
	message.backgroundColor = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:0.8f];
	message.font = [UIFont fontWithName:@"Arial" size:50.0f];
	[message setAlpha:1.0f];
	[self.view addSubview:message];
	[self.view bringSubviewToFront:message];
	[message release];
}



/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];

}
 */



// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end
